package com.naiterui.ehp.bs.doctor.vo;

import java.io.Serializable;

import javax.validation.constraints.NotEmpty;

import org.apache.commons.lang3.StringUtils;

import com.naiterui.ehp.bp.support.exception.BusinessException;
import com.naiterui.ehp.bs.doctor.exception.ExceptionCodes;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.ToString;

@Data
@ToString
@ApiModel(value = "LicenseParam", description = "新资质参数VO")
public class LicenseNewParam implements Serializable {

    private static final long serialVersionUID = 5637226411863550238L;

    @ApiModelProperty(value = "医师执业证号")
    private String number;

    @ApiModelProperty(value = "个人照片")
    @NotEmpty(message = "个人照片不可为空")
    private String avatarUrl;

    @ApiModelProperty(value = "工作证")
    private String emCardUrl;

    @ApiModelProperty(value = "医师执业证")
    private String medicalUrl;

    @ApiModelProperty(value = "医师执业证补充页")
    private String supplyMedicalUrl;

    @ApiModelProperty(value = "签章图片")
    private String sealImgUrl;

    /**
     * 参数校验
     */
    public void validate() throws BusinessException {
        if (StringUtils.isEmpty(this.medicalUrl) && StringUtils.isEmpty(this.supplyMedicalUrl)) {
            throw new BusinessException(ExceptionCodes.PARAM_ERROR);
        }
    }
}
